//
// Created by 123 on 2024/12/30.
//
#include "iostream"
using namespace std;

int& test01(){
    int a = 10;
    return a;
}

int& test02(){
    static int a = 20;
    return a;
}

int main045(){
//    int& ref = test01();
//    cout << ref << endl;
//    cout << ref << endl;

    //函数作为左侧接受赋值，必须返回引用
    int& ref2 = test02();
    cout << ref2 << endl;
    ref2 = 1000;
    cout << ref2 << endl;


    return 0;
}